package com.cecw.controller;

import com.cecw.pojo.Project;
import com.cecw.service.ProjectService;
import io.swagger.annotations.ApiOperation;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;

/**
 * @author:llx
 */
@RestController
public class ProjectController {
    @Resource
    private ProjectService projectService;

    @ApiOperation("指定起止时间、项目名称获取项目列表")
    @GetMapping("/list")
    public List<Project> projectList(
            @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate startTime,
            @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate endTime,
            String[] selectedProjectList) {
        List<Project> projectList = projectService.getList(startTime, endTime, selectedProjectList);
        return projectList;
    }
}
